package com.cuitrip.business.crash;

import com.cuitrip.app.base.CtException;
import com.tencent.bugly.crashreport.CrashReport;

/**
 * Created by ak on 4/18/16.
 */
public class CTCrashReport {

    private String requestUrl;
    private String requestParams;
    private int responseCode;
    private String responseBody;

    public CTCrashReport(String requestUrl, String requestParams, int responseCode, String responseBody) {
        this.requestUrl = requestUrl;
        this.requestParams = requestParams;
        this.responseCode = responseCode;
        this.responseBody = responseBody;
    }

    public static void reportCrash(String requestUrl, String requestParams, int responseCode, String responseBody) {
        try {
            CTCrashReport ctCrashReport = new CTCrashReport(requestUrl, requestParams, responseCode, responseBody);
            CrashReport.postCatchedException(new CtException(ctCrashReport.toString()));
        } catch (Exception e) {

        }

    }

    @Override
    public String toString() {
        return "Response{code="
                + responseCode
                + ", url="
                + requestUrl
                + ", requestBody="
                + requestParams
                + ", responseBody="
                + responseBody
                + '}';
    }

}
